<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>12vue简易计算器</title>
    <script type="text/javascript" src="static/vue.min.js"></script>
</head>

<body>
<div class="tab_con">
    <!--使用v-model双向数据绑定-->
    <input type="text"v-model="num1">
    <select  v-model="sel">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text"v-model="num2">
    <input type="button"value="=" @click="calculator()">
    <input type="text" v-model="result">
</div>
<script>
    new Vue({
        el: ".tab_con",
        data: {
            num1:"",
            sel:"*",
            num2:"",
            result:""
        },
        methods: {
            calculator:function () {
                // 数值计算并将字符串转换为数值
                this.result=eval(this.num1+this.sel+this.num2)
            }
        }
    })
</script>
</body>
</html>